<template>
  <div>
    <el-row>
      <el-col :span="24">
        <el-radio-group v-model="type" size="mini" @change="changeRadio">
          <el-radio :label="0">驳回</el-radio>
          <el-radio :label="1">通过</el-radio>
        </el-radio-group>

      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        {{tip}}
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <el-select :value="value" @change="change">
          <el-option v-for="(item,index) in nodes" :key="index" :label="item.name" :value="item.id"></el-option>
        </el-select>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "Approve",
  props: {
    value:String,
    nextNodes:{
      type:Array,
      require:true,
      default:() => {
        return []
      }
    },
    prevNodes:{
      type:Array,
      require:true,
      default:() => {
        return []
      }
    },
  },
  data() {
    return {
      type:0
    }
  },
  computed:{
    nodes() {
      return this.type == 0 ? this.prevNodes : this.nextNodes
    },
    tip() {
      return this.type == 1 ? '请选择下一个审批节点' : '请选择驳回节点'
    }
  },
  methods:{
    change(val) {
      this.$emit('input',val)
    },
    changeRadio(val) {
      this.$emit('changeRadio',val)
    }
  }
}
</script>

<style scoped>

</style>